<template>
    <div class="xl-table">
        <div class="xl-table-content">
            <xlTable
                    :queryParam="queryParam"
                    :columns="columns"
                    :dataSource="data"
                    rowKey="id"
                    :pagination="pagination"
                    :loading="loading"
                    @change="handleTableChange"
                    bordered
                    :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
                >
                <template v-slot:action="scope">
                    <a @click="(e)=>{
                            e.target.style.color='#999'
                            seeForm(scope.record)
                        }">查看</a>
                </template>
            </xlTable>
        </div>
        <xlForm :column="2" ref="xlForm" @handleOk="handleOk"></xlForm>
        <seeForm ref="seeForm"></seeForm>
    </div>
</template>

<script>

    import xlMixin from '../../../components/mixin'
    export default {
        name: "index",
        mixins:[xlMixin],
        data(){
            return{
                columns:[
                    {
                        title: '序号',
                        key: 'rowIndex',
                        align: "center",
                        fixed: 'left',
                        width:'100px',
                        sorter: (a) => a.id,//排序
                        customRender: function (t, r, index) {
                            return parseInt(index) + 1;
                        }
                    },
                    {
                        title: '姓名',
                        fixed: 'left',
                        width:'175px',
                        dataIndex: 'name',
                        type:'input'
                    },
                    {
                        title: '职务',
                        dataIndex: 'occupation',
                        type:'input',
                        required:false
                    },
                    {
                        title: '学历',
                        dataIndex: 'education',
                        type:'input',
                        required:false
                    },
                    {
                        title: '专业',
                        dataIndex: 'professional',
                        type:'input',
                        required:false
                    },
                    {
                        title: '是否经过专业化培训',
                        dataIndex: 'isTrainedFlag',
                        type:'radio',
                        required:false,
                        typeData:[
                            {
                                dataName:'是',
                                dataValue:true
                            },
                            {
                                dataName:'否',
                                dataValue:false
                            }
                        ]
                    },
                    {
                        title: '手机',
                        dataIndex: 'phone',
                        type:'input'
                    },
                    {
                        title: '电子邮件',
                        dataIndex: 'email',
                        type:'input',
                        required:false
                    },
                    {
                        title: '传真',
                        dataIndex: 'fax',
                        type:'input',
                        required:false
                    },
                    {
                        title: '是否全职',
                        dataIndex: 'isFulltimeFlag',
                        type:'radio',
                        required:false,
                        typeData:[
                            {
                                dataName:'是',
                                dataValue:true
                            },
                            {
                                dataName:'否',
                                dataValue:false
                            }
                        ]
                    },
                    {
                        title: '附件',
                        dataIndex: 'materialPath',
                        type:'upload.file',
                        required:false,
                        fileTitle:{
                            titleVisible:true,
                            title:"上传聘书等相关材料"
                        }
                    },
                    // {
                    //     title: '是否负责人',
                    //     dataIndex: 'isMasterFlag',
                    //     type:'radio',
                    //     typeData:[
                    //         {
                    //             dataName:'是',
                    //             dataValue:true
                    //         },
                    //         {
                    //             dataName:'否',
                    //             dataValue:false
                    //         }
                    //     ]
                    // },
                    // {
                    //     title: '是否联系人',
                    //     dataIndex: 'isContactFlag',
                    //     type:'radio',
                    //     typeData:[
                    //         {
                    //             dataName:'是',
                    //             dataValue:true
                    //         },
                    //         {
                    //             dataName:'否',
                    //             dataValue:false
                    //         }
                    //     ]
                    // },
                    {
                        title: '操作',
                        dataIndex: 'action',
                        align: "center",
                        fixed: 'right',
                        width:'150px',
                        scopedSlots: {customRender: 'action'},
                    }
                ],
                url: {
                    list: "/carrier/api/carrierEmployee/pageList",
                    add: "/carrier/api/carrierEmployee/add",
                    edit: "/carrier/api/carrierEmployee/update",
                    delete: "/carrier/api/carrierEmployee/remove",
                    deleteBatch: "/carrier/api/carrierTeacher/remove",
                    exportXlsUrl: "/carrier/api/carrierEmployee/exportExcel",
                    importExcelUrl: "/carrier/api/carrierEmployee/importExcel",
                    importExcelDemoUrl: "/carrier/api/carrierEmployee/importTemplate",
                }
            }
        },
        props:{
            carrierId:Number,
            filterYear:String
        },
        created(){
            this.queryParam.carrierId = this.carrierId
            this.queryParam.filterYear = this.filterYear
            this.formatMerge()
            this.pageOnload()
        },
        watch:{
            carrierId(){
                this.queryParam.carrierId = this.carrierId
                this.queryParam.filterYear = this.filterYear
                this.pagination.current = 1
                this.pageOnload()
            },
            filterYear(){
                this.queryParam.carrierId = this.carrierId
                this.queryParam.filterYear = this.filterYear
                this.pagination.current = 1
                this.pageOnload()
            }
        }
    }
</script>

<style scoped lang="less">
    .xl-table{
        .xl-table-content{
            padding: 16px;
        }
    }
</style>
